Extensions should have the final say on their compiler flags#6204
Closed
Girgias wants to merge 2 commits into
Closed
Extensions should have the final say on their compiler flags#6204Girgias wants to merge 2 commits into
Girgias wants to merge 2 commits into
Conversation
nikic
reviewed
Sep 25, 2020
f2e7ca8 to
147bf84
Compare
nikic
approved these changes
Sep 28, 2020
nikic
left a comment
Member
There was a problem hiding this comment.
Looks reasonable to me at least. I've run into this problem as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently compiler flags passed by extensions using the standard
PHP_NEW_EXTENSIONandPHP_ADD_SOURCESm4 macros are prepended before the ones defined byZend/Zend.m4. This was not really an issue before asZend.m4only included-Wallbut since the addition of-Wextravarious issue about disabling flags have been brought up, notably by @bwoebi and I've hit this once again in #6199A preliminary attempt was 5c1cf76 but this turns out to be more or less irrelevant.
The root issue is that
PHP_NEW_EXTENSIONandPHP_ADD_SOURCEScall thePHP_ADD_SOURCES_Xmacro and pass their flags as the 3rd argument which prepends the flags. There exists a 6th argument for this macro which appends them but from a cursory look at https://heap.space/search?full=PHP_ADD_SOURCES_X&project=php-src this is not used. Moreover, the comment describing this macro explicitly informs that this macro should not be used directly.The proposal is to drop the 6th argument of
PHP_ADD_SOURCES_Xand move thespecial-flagsargument to be appended instead of prepended.